#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

#include "evm_config.h"
#include "evm_stack.h"
#include "evm_error.h"
#include "evm_memory.h"
#include "evm.h"
#include "evm_opcode.h"


uint8_t code[] = {
    PUSH,
    0x07,
    0x00,
    0x00,
    0x00,
    PUSH,
    0x08,
    0x00,
    0x00,
    0x00,
    DBGDATA,
    MUL,
    DBGDATA,
    PUSH,
    0x05,
    0x00,
    0x00,
    0x00,
    MOD,
    DBGDATA,
    POP,
    DBGDATA,
    STOP
};

uint32_t codesize = sizeof( code );

int main(void)
{
    evm       *vm;
    uint32_t   res;

    vm = evm_new();

    res = evm_load_mem( vm, code, codesize );

    res = evm_run( vm );
    if ( res != 0 ) {
        printf("evm> error %d\n", res );
        exit( EXIT_FAILURE );
    }
    return 0;
}

